import { request } from '@/utils/hsj/service/index'

// 查询文件列表
export function fileList(query) {
  return request({
    url: '/system/file/list',
    method: 'get',
    params: query,
  })
}

// 查询文件详细
export function getFile(fileId) {
  return request({
    url: '/system/file/' + fileId,
    method: 'get',
  })
}

// 新增文件
export function insert(data) {
  return request({
    url: '/system/file',
    method: 'post',
    data: data,
  })
}

// 批量新增文件
export function insertBatch(data) {
  return request({
    url: '/system/file/insertBatch',
    method: 'post',
    data: data,
  })
}

// 修改文件
export function updateFile(data) {
  return request({
    url: '/system/file',
    method: 'put',
    data: data,
  })
}

// 删除文件
export function del(fileId) {
  return request({
    url: '/system/file/' + fileId,
    method: 'delete',
  })
}

// 下载文件
export function download(data) {
  return request({
    url: '/system/file/download/',
    method: 'post',
    responseType: 'blob',
    data: data
  })
}

//新增共享文件
export function insertFilePermission(data){
  return request({
    url: '/system/file/permission',
    method: 'post',
    data: data,
  })
}

//新增共享文件
export function insertFilePermissionBatch(data){
  return request({
    url: '/system/file/permission/addBatch',
    method: 'post',
    data: data,
  })
}

//查询共享文件
export function filePermissionList(query){
  return request({
    url: '/system/file/permission/list',
    method: 'get',
    params: query,
  })
}

//查看共享人员列表
export function sharedList(query){
  return request({
    url: '/system/file/permission/sharedList',
    method: 'get',
    params: query,
  })
}

//删除共享文件
export function deleteFilePermission(id){
  return request({
    url: '/system/file/permission/' + id,
    method: 'delete',
  })
}






